import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/index.vue'
import Layout from '@/views/layout/index.vue'

import Home from '@/views/home/index.vue'
import My from '@/views/my/index.vue'
import Qa from '@/views/qa/index.vue'
import Video from '@/views/video/index.vue'
import Search from '@/views/search/index.vue'
import Article from '@/views/article/index.vue'
import UserProfile from '@/views/user-profile/index.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: Login },
  { path: '/user/profile', component: UserProfile },
  { path: '/article/:articleID', component: Article, props: true },
  {
    path: '/',
    component: Layout,
    children: [
      { path: '', component: Home },
      { path: 'my', component: My },
      { path: 'qa', component: Qa },
      { path: 'video', component: Video }
    ]
  },
  { path: '/search', component: Search }
]

const router = new VueRouter({
  routes
})

export default router
